-
Notifications
You must be signed in to change notification settings - Fork 79
Bounds Widening: Fix handling of bounds variables for nt_array_ptrs #898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ptrs There were 2 issues with determination of variables used in the declared bounds of an _Nt_array_ptr: 1. Bounds variables were being determined only for _Nt_array_ptrs declared in the current block. As a result, if another block kills a particular variable then the widened bounds in the successor blocks could not be killed. 2. Bounds variables for function parameters were not getting determined correctly. Also performed minor NFC code cleanups. Fixes #895
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good. I had some questions about the clean up. It was a little difficult to follow the clean up intermixed with the bug fix. It is helpful to keep them separate.
@@ -490,7 +489,7 @@ void f20() { | |||
// CHECK: [B9] | |||
// CHECK: upper_bound(q) = 1 | |||
|
|||
// Declared bounds (INT_MIN) and deref offset (INT_MAX - 1). No sequential deref tests. No widening. | |||
// Declared bounds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why you deleted the rest of the comment. Same goes for other changes in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this. The comments should not have been deleted. Not sure how that happened. I will fix this.
Early calculation of bounds vars for nt_array_ptrs with invalid bounds caused two checkedc runtime tests to fail. Moving the calculation of bounds vars to FillGenSetForEdge fixes this as this function is not invoked for nt_array_ptrs with invalid bounds. Also fixed indentation and comments in tests.
There were 3 issues with the handling of variables used in the declared bounds
of an
nt_array_ptr
:Bounds variables were being determined only for
nt_array_ptr
s declared inthe current block. As a result, if a variable is killed in a block then the
widened bounds in the successor blocks could not be killed. This is fixed by
storing the bounds variables along with the
nt_array_ptr
s for the entirefunction instead of per block.
Bounds variables for function parameters were not getting determined
correctly. This is fixed by uniforming the logic to determine bounds
variables for function parameters and local variables.
Bounds declared as
CountBoundsExpr
were not being handled. This is fixed byreading the
NormalizedBounds
instead of invokingExpandBoundsToRange
.Also performed minor NFC code cleanups.
Fixes #895